ARM: vGIC: move irq_to_pending() calls under the VGIC VCPU lock
authorAndre Przywara <andre.przywara@arm.com>
Mon, 10 Apr 2017 18:05:16 +0000 (19:05 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 14 Jun 2017 18:38:37 +0000 (11:38 -0700)
commit5f66da659060563df8481a86c017f07455095045
tree56ae1266fce5ab6ca5663bafcdbb15a7943c4c9c
parenta3c32b833254b16dcdc08227c13646ab8bba931c
ARM: vGIC: move irq_to_pending() calls under the VGIC VCPU lock

So far irq_to_pending() is just a convenience function to lookup
statically allocated arrays. This will change with LPIs, which are
more dynamic, so the memory for their struct pending_irq might go away.
The proper answer to the issue of preventing stale pointers is
ref-counting, which requires more rework and will be introduced with
a later rework.
For now move the irq_to_pending() calls that are used with LPIs under the
VGIC VCPU lock, and only use the returned pointer while holding the lock.
This prevents the memory from being freed while we use it.
For the sake of completeness we take care about all irq_to_pending()
users, even those which later will never deal with LPIs.
Document the limits of vgic_num_irqs().

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/vgic.c
xen/include/asm-arm/vgic.h